<template>
  <div class="q-pa-md">
    <div class="q-gutter-y-md column" style="max-width: 300px">
      <t-toggle v-model="dense" label="Dense QInput" />

      <t-input outlined v-model="text" :dense="dense" />

      <t-input
        outlined
        v-model="text"
        label="Label (stacked)"
        stack-label
        :dense="dense"
      />

      <t-input outlined v-model="text" label="Label" :dense="dense" />

      <t-input
        outlined
        v-model="ph"
        label="Label"
        placeholder="Placeholder"
        hint="With placeholder"
        :dense="dense"
      />

      <t-input
        outlined
        v-model="ph"
        placeholder="Placeholder"
        hint="With placeholder"
        :dense="dense"
      />

      <t-input
        outlined
        square
        v-model="text"
        hint="With perfect square borders"
        :dense="dense"
      />

      <t-input outlined v-model="text" :dense="dense">
        <template v-slot:prepend>
          <t-icon name="event" />
        </template>
      </t-input>

      <t-input outlined v-model="text" :dense="dense">
        <template v-slot:append>
          <t-avatar>
            <img src="https://cdn.quasar.dev/logo-v2/svg/logo.svg" />
          </t-avatar>
        </template>
      </t-input>

      <t-input
        outlined
        bottom-slots
        v-model="text"
        label="Label"
        counter
        :dense="dense"
      >
        <template v-slot:prepend>
          <t-icon name="place" />
        </template>
        <template v-slot:append>
          <t-icon name="close" @click="text = ''" class="cursor-pointer" />
        </template>

        <template v-slot:hint> Field hint </template>
      </t-input>

      <t-input
        outlined
        bottom-slots
        v-model="text"
        label="Label"
        counter
        maxlength="12"
        :dense="dense"
      >
        <template v-slot:before>
          <t-icon name="flight_takeoff" />
        </template>

        <template v-slot:append>
          <t-icon
            v-if="text !== ''"
            name="close"
            @click="text = ''"
            class="cursor-pointer"
          />
          <t-icon name="search" />
        </template>

        <template v-slot:hint> Field hint </template>
      </t-input>

      <t-input
        outlined
        bottom-slots
        v-model="text"
        label="Label"
        counter
        maxlength="12"
        :dense="dense"
      >
        <template v-slot:before>
          <t-avatar>
            <img src="https://cdn.quasar.dev/img/avatar5.jpg" />
          </t-avatar>
        </template>

        <template v-slot:append>
          <t-icon
            v-if="text !== ''"
            name="close"
            @click="text = ''"
            class="cursor-pointer"
          />
          <t-icon name="schedule" />
        </template>

        <template v-slot:hint> Field hint </template>

        <template v-slot:after>
          <t-btn round dense flat icon="send" />
        </template>
      </t-input>

      <t-input
        outlined
        bottom-slots
        v-model="text"
        label="Label"
        counter
        maxlength="12"
        :dense="dense"
      >
        <template v-slot:before>
          <t-icon name="event" />
        </template>

        <template v-slot:hint> Field hint </template>

        <template v-slot:append>
          <t-btn round dense flat icon="add" />
        </template>
      </t-input>

      <t-input outlined v-model="text" hint="Disable" :dense="dense" disable />

      <t-input
        outlined
        v-model="text"
        hint="Readonly"
        :dense="dense"
        readonly
      />

      <t-input
        outlined
        v-model="text"
        hint="Disable and readonly"
        :dense="dense"
        disable
        readonly
      />
    </div>
  </div>
</template>

<script>
  import { ref } from 'vue';

  export default {
    setup() {
      return {
        text: ref(''),
        ph: ref(''),
        dense: ref(false),
      };
    },
  };
</script>
